package day06;

import com.sun.xml.internal.fastinfoset.tools.XML_SAX_StAX_FI;

import java.util.Arrays;

public class MaxofArray12 {
    public static void main(String[] args) {
        int[] array = new int[20];
        for (int s = 0; s < array.length-1;s++){
            array[s] = (int) (Math.random()*100);//存入数据
        }
        //数组最大值
        int w = array[0];
        for (int m = 1;m <array.length;m++){
            if (array[m]>w){
                w = array[m];
            }
        }
        System.out.println("最大值为"+w);
        //排序
//        Arrays.sort(array);
//        for (int x = 0;x <array.length;x++){
//            System.out.println(array[x]);
//        }


        array = Arrays.copyOf(array,array.length+3);
        array[array.length-1] = w;
        System.out.println(Arrays.toString(array));
    }
}
